local skill = fk.CreateSkill{
  name = "tea__xiangqian",
}
---@type ActiveSkillSpec
local xiangqian = {
  anim_type = "support",
  target_num = 1,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and to_select ~= player
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    local cids = room:askToPoxi(player, {
      poxi_type = "tea__xiangqian_poxi",
      data = {
        { target.general, target:getCardIds("h") },
        { player.general, player:getCardIds("h") },
      }
    })
    if #cids > 0 then
      room:recastCard(cids, player, skill.name)
    end
    if not player.dead and not target.dead then
      cids = room:askToPoxi(target, {
        poxi_type = "tea__xiangqian_poxi",
        data = {
          { player.general, player:getCardIds("h") },
          { target.general, target:getCardIds("h") },
        }
      })
      if #cids > 0 then
        room:recastCard(cids, target, skill.name)
      end
    end
  end,
}
Fk:addPoxiMethod{
  name = "tea__xiangqian_poxi",
  card_filter = function(to_select, selected, data)
    if table.contains(data[2][2], to_select) then
      return table.find(data[1][2], function(id)
        return Fk:getCardById(id).trueName == Fk:getCardById(to_select).trueName
      end)
    end
  end,
  feasible = function(selected)
    return true
  end,
  prompt = "tea__xiangqian_poxi-ask",
}
skill:addEffect("active", xiangqian)
return skill